# -*- coding: utf-8 -*-
# __author__ :Li
# 2022/5/7 17:25
#售后API


#售后信息查询
def refund_query(self,shop_id=None,is_offline_shop=False,modified_begin='',modified_end='',so_ids=None,shop_buyer_ids=None,page_index=1,page_size=50):
    '''
    :param self:
    :param shop_id:店铺编号:int
    :param is_offline_shop:shop_id为0且is_offline_shop为true查询线下店铺单据:bool
    :param modified_begin:修改起始时间，和结束时间必须同时存在，时间间隔不能超过七天，与线上单号不能同时为空:string
    :param modified_end:修改结束时间，和起始时间必须同时存在，时间间隔不能超过七天，与线上单号不能同时为空:string
    :param so_ids:指定线上订单号，和时间段不能同时为空:list
    :param shop_buyer_ids:指定买家账号，最多50:list
    :param page_index:第几页，从第一页开始，默认1:int
    :param page_size:每页多少条，默认30，最大50:int
    :return:
    '''
    params = {}
    if shop_id is not None:
        params['shop_id'] = shop_id
    if is_offline_shop is not None:
        params['is_offline_shop'] = is_offline_shop
    if so_ids is not None:
        params['so_ids'] = so_ids
    if modified_begin:
        params['modified_begin'] = modified_begin
    if modified_end:
        params['modified_end'] = modified_end
    if page_index:
        params['page_index'] = page_index
    if shop_buyer_ids is not None:
        params['shop_buyer_ids'] = shop_buyer_ids
    params['page_size'] = page_size
    path = '/open/refund/single/query'
    return self.request(path=path, data=params)

#售后实际收货查询
def aftersale_received_query(self,page_size=50,modified_begin='',modified_end='',so_ids=None,o_ids=None,page_index=1,shop_id='',date_type=None):
    '''
    实际收货查询
    :param self:
    :param page_size:
    :param modified_begin:
    :param modified_end:
    :param so_ids:
    :param o_ids:
    :param page_index:
    :param shop_id:
    :param date_type:
    :return:
    '''
    path = '/open/aftersale/received/query'
    params = {
        'page_size':page_size,
        'page_index':page_index
    }
    if modified_begin:
        params['modified_begin'] = modified_begin
    if modified_end:
        params['modified_end'] = modified_end
    if so_ids is not None:
        params['so_ids'] = so_ids
    if o_ids is not None:
        params['o_ids'] = o_ids
    if shop_id:
        params['shop_id'] = shop_id
    if date_type is not None:
        params['date_type'] = date_type
    return self.request(path=path,data=params)
